package cn.xopencode.recordservice.manager.drytransformer;


import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.drytransformer.DryTransformerRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.rpc.drytransformer.dto.DryTransformerRecordCreateDTO;
import cn.xopencode.recordservice.rpc.drytransformer.dto.DryTransformerRecordPageDTO;
import cn.xopencode.recordservice.rpc.drytransformer.dto.DryTransformerRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.drytransformer.vo.DryTransformerRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.drytransformer.vo.DryTransformerRecordPageVO;
import cn.xopencode.recordservice.rpc.drytransformer.vo.DryTransformerRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.service.drytransformer.DryTransformerRecordService;
import cn.xopencode.recordservice.service.drytransformer.bo.DryTransformerRecordCreateBO;
import cn.xopencode.recordservice.service.drytransformer.bo.DryTransformerRecordUpdateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DryTransformerRecordManager {

    @Autowired
    private DryTransformerRecordService dryTransformerRecordService;

    public Integer createDryTransformerRecord(DryTransformerRecordCreateDTO createDTO) {
        DryTransformerRecordCreateBO bo = DryTransformerRecordConvert.INSTANCE.convert(createDTO);
        Integer result = dryTransformerRecordService.createDryTransformerRecord(bo, createDTO.getEmpIds());
        return result;
    }

    public PageResult<DryTransformerRecordPageVO> pageDryTransformerRecord(DryTransformerRecordPageDTO pageDTO) {
        PageResult<DryTransformerRecordPageVO> boPageResult = dryTransformerRecordService.pageDryTransformerRecord(DryTransformerRecordConvert.INSTANCE.convert(pageDTO));
        return boPageResult;
    }

    public DryTransformerRecordUpdateVO getDryTransformerRecordById(String id){
        DryTransformerRecordUpdateVO updateVO = dryTransformerRecordService.getDryTransformerRecordById(id);
        return updateVO;
    }

    public Integer updateDryTransformerRecord(DryTransformerRecordUpdateDTO updateDTO) {
        DryTransformerRecordUpdateBO bo = DryTransformerRecordConvert.INSTANCE.convert(updateDTO);
        return dryTransformerRecordService.updateDryTransformerRecord(bo, updateDTO.getEmpIds());
    }

    public Integer dealDryTranformerRecordException(String recordId){
        return  dryTransformerRecordService.dealDryTranformerRecordException(recordId);
    }

    public PageResult<DryTransformerRecordAdminPageVO> getAdminPageDryTranformerRecord(AdminRecordPageDTO pageDTO){
        return dryTransformerRecordService.getAdminPageDryTranformerRecord(AdminRecordConvert.INSTANCE.convert(pageDTO));
    }
}
